﻿//扫雷游戏的实现
#define _CRT_SECURE_NO_WARNINGS 1
#include"game.h"
void menu()
{
	printf("*******************\n");
	printf("*******Play.1******\n");
	printf("*******Over.2******\n");
	printf("*******************\n");
}
void game()
{
	printf("开始扫雷游戏\n");
	char mine[ROWS][COLS] = { 0 };
	char show[ROWS][COLS] = { 0 };
	InitBoard(mine, ROWS, COLS, '0');//
	InitBoard(show, ROWS, COLS, '*');
	//DisplayBoard(mine, ROW, COL);//多余的//访问是9✖9
	DisplayBoard(show, ROW, COL);
	//布置雷
	SetMine(mine, ROW, COL);
	//DisplayBoard(mine, ROW, COL);//多余的
	//排除雷——扫雷
	FindMine(mine, show, ROW, COL);
	//传mine数组过去计算雷
	//传show数组展示计算雷的结果

}
int main()
{
	int input = 0;
	srand((unsigned int)time(NULL));
	do
	{
		printf("欢迎来到扫雷游戏!\n");
		menu();
		printf("请输入您的选择：\n");
		scanf("%d", &input);
		switch (input)
		{
		case 1:
			game();
			break;
		case 0:
			printf("游戏结束\n");
			break;
		default:
			printf("输入选择有误，请重新选择\n");
			break;
		}
	} while (input);
}

